#ifndef WIFISERIAL_H
#define WIFISERIAL_H

#include <QWidget>
#include <QtSerialPort>

extern QSerialPort *serial3;
extern QString tmpData;
extern QString humData;
extern unsigned long lightData;
extern unsigned int distanceData;
extern bool imageReadFlag;
extern bool imageWriteFlag;
extern bool LEDFlag;

namespace Ui
{
    class WIFIserial;
}

class WIFIserial : public QWidget
{
    Q_OBJECT

public:
    explicit WIFIserial(QWidget *parent = 0);
    virtual void timerEvent(QTimerEvent *event);
    QString ssid;     // 用于存储Wi-Fi名称
    QString password; // 用于存储Wi-Fi密码
    QString IP;       // 用于存储Wi-Fi名称
    QString Port;     // 用于存储Wi-Fi密码
    ~WIFIserial();

private slots:
    void on_goback_clicked();

    void on_setSAT_clicked();

    void on_reset_clicked();

    void on_endSend_clicked();

    void on_start_clicked();

    void on_send_clicked();

    void waitForResponse();

    void on_rst_tcp_clicked();

    void on_IP_clicked();

private:
    Ui::WIFIserial *ui;
    void readSerial3();
    void sendJPEGImage(const QString &filePath);
    void parseData(const QByteArray &data);
    QString storedIP;

signals:
    void goback();
};

#endif // WIFISERIAL_H
